<?php

use think\migration\Migrator;
use Phinx\Db\Adapter\MysqlAdapter;

class CreateNodesTable extends Migrator
{
    /**
     * Migrate Up.
     */
    public function up()
    {
        $this->table('nodes', ['comment' => '节点表', 'id' => 'id', 'primary_key' => ['id']])
            ->addColumn('remark', 'string', ['limit' => 250,'default' => '','comment' => '节点备注'])
            ->addColumn('host', 'string', ['limit' => 100,'default' => '','comment' => '节点地址'])
            ->addColumn('port', 'string', ['limit' => 10,'default' => '22','comment' => '节点端口'])
            ->addColumn('username', 'string', ['limit' => 100,'default' => '','comment' => '用户名'])
            ->addColumn('password', 'string', ['limit' => 100,'default' => '','comment' => '节点密码'])
            ->addColumn('loading', 'string', ['limit' => 100,'default' => '', 'comment' => '执行状态'])
            ->addColumn('is_line', 'boolean', ['limit' => 1,'default' => 0,'comment' => '是否在线'])
            ->addColumn('cc', 'integer', ['limit' => 10,'default' => 0,'comment' => '系统连接次数'])
            ->addColumn('domains', 'text', ['comment' => '可用域名'])
            ->addTimestamps()           
            ->create();
    }

    /**
     * Migrate Down.
     */
    public function down()
    {
        $this->dropTable('nodes');
    }
}
